import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus/dist/index.css'
import './assets/base.css'
import App from './App.vue'
import router from './router'

console.log('Starting app initialization')

const app = createApp(App)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 初始化 Pinia
console.log('Initializing Pinia')
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
app.use(pinia)

// 初始化 Element Plus
console.log('Initializing Element Plus')
app.use(ElementPlus, {
  size: 'default'
})

// 初始化路由
console.log('Initializing Router')
app.use(router)

// 挂载应用
console.log('Mounting app')
app.mount('#app')

console.log('App initialization completed') 